package com.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.dao.ChanpinchoujianDao;
import com.entity.ChanpinchoujianEntity;
import com.entity.view.ChanpinchoujianView;
import com.entity.vo.ChanpinchoujianVO;
import com.service.ChanpinchoujianService;
import com.utils.PageUtils;
import com.utils.Query;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ChanpinchoujianServiceImpl extends ServiceImpl<ChanpinchoujianDao, ChanpinchoujianEntity>
        implements ChanpinchoujianService {
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<ChanpinchoujianEntity> page = this.selectPage(
                new Query<ChanpinchoujianEntity>(params).getPage(),
                new EntityWrapper<ChanpinchoujianEntity>()
        );
        return new PageUtils(page);
    }

    @Override
    public PageUtils queryPage(Map<String, Object> params, Wrapper<ChanpinchoujianEntity> wrapper) {
        Page<ChanpinchoujianView> page =new Query<ChanpinchoujianView>(params).getPage();
        page.setRecords(baseMapper.selectListView(page,wrapper));
        PageUtils pageUtil = new PageUtils(page);
        return pageUtil;
    }

    @Override
    public List<ChanpinchoujianVO> selectListVO(Wrapper<ChanpinchoujianEntity> wrapper) {
        return baseMapper.selectListVO(wrapper);
    }

    @Override
    public ChanpinchoujianVO selectVO(Wrapper<ChanpinchoujianEntity> wrapper) {
        return baseMapper.selectVO(wrapper);
    }

    @Override
    public List<ChanpinchoujianView> selectListView(Wrapper<ChanpinchoujianEntity> wrapper) {
        return baseMapper.selectListView(wrapper);
    }

    @Override
    public ChanpinchoujianView selectView(Wrapper<ChanpinchoujianEntity> wrapper) {
        return baseMapper.selectView(wrapper);
    }

}
